import { PayloadUser } from '@libs/common/decorator';
import { IndexInterceptor } from '@libs/common/interceptors';
import { Body, Controller, Post, UseInterceptors } from '@nestjs/common';

import {
  IndexPointsWaitDto,
  SendPointsWaitDto,
  ShowPointsWaitDto,
  UpdatePointsWaitDto,
} from './dto/points-wait.dto';
import { PointsWaitService } from './points-wait.service';

@Controller('market/points-wait')
export class PointsWaitController {
  constructor(private readonly attendancePointsService: PointsWaitService) {}

  @Post('index')
  @UseInterceptors(new IndexInterceptor())
  index(@Body() dto: IndexPointsWaitDto) {
    return this.attendancePointsService.index(dto);
  }

  @Post('show')
  show(@Body() dto: ShowPointsWaitDto) {
    return this.attendancePointsService.show(dto);
  }

  @Post('update')
  update(
    @Body() dto: UpdatePointsWaitDto,
    @PayloadUser() user: SC.User.SysInfo,
  ) {
    return this.attendancePointsService.update(dto);
  }

  @Post('send')
  sendPoints(
    @Body() dto: SendPointsWaitDto,
    @PayloadUser() user: SC.User.SysInfo,
  ) {
    return this.attendancePointsService.sendPoints(dto, user);
  }
}
